<template>
  <div>
    <el-dialog title="查看详情" :visible.sync="dialogVisible">
      <el-form label-position="left">
        <el-row>
          <el-col v-for="col in columns" :key="col.name" :span="12">
            <el-form-item :label="`${col.label}:`" style="width: 366px">
              <span>{{ data[col.name] }}</span>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'ViewDialog',
  components: {},
  directives: {},
  filters: {},

  props: {
    visible: { type: Boolean, default: () => false },

    data: {
      type: Object,
      default: () => {
        return {}
      }
    },
    columns: {
      type: Array,
      default: () => []
    }
  },

  data() {
    return {
      dialogVisible: false
    }
  },

  computed: {
    //
  },

  watch: {
    visible(val) {
      this.dialogVisible = this.visible
    },

    dialogVisible(val) {
      this.$emit('update:visible', this.dialogVisible)
    }
  },

  methods: {
    //
  }
}
</script>
